<%@ page import="kioscodeal.User" %>


<div class="panel panel-info">
  <div class="panel-heading">
	<h3 class="panel-title">Datos de sesión</h3>
  </div>
  <div class="panel-body">
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'login', 'error')} required">
		<label for="username">
			<g:message code="user.login.label" default="Login" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:textField name="login" required="" value="${userInstance?.login}" placeholder="Login"/>
		</div>
	</div>
	
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'password', 'error')} required">
		<label for="password">
			<g:message code="user.password.label" default="Password" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field type="password" name="password" required="" value="${userInstance?.password}" placeholder="Password"/>
		</div>
	</div>
	
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'mail', 'error')} required">
		<label for="mail">
			<g:message code="user.mail.label" default="E-Mail" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field type="email" name="mail" required="" value="${userInstance?.mail}" placeholder="usuario@kioscodeal.com.ar"/>
		</div>
	</div>
  </div>
</div>


<div class="panel panel-info">
  <div class="panel-heading">
	<h3 class="panel-title">Datos personales</h3>
  </div>
  <div class="panel-body">
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'nombre', 'error')} required">
		<label for="nombre">
			<g:message code="user.nombre.label" default="Nombre" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:textField name="nombre" required="" value="${userInstance?.nombre}" placeholder="Nombre"/>
		</div>
	</div>
	
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'apellido', 'error')} required">
		<label for="apellido">
			<g:message code="user.apellido.label" default="Apellido" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:textField name="apellido" required="" value="${userInstance?.apellido}" placeholder="Apellido"/>
		</div>
	</div>
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'fechaNacimiento', 'error')} required">
		<label for="fechaNacimiento">
			<g:message code="user.fechaNacimiento.label" default="Fecha de Nacimiento" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			<g:datePicker name="fechaNacimiento" precision="day"  value="${userInstance?.fechaNacimiento}" placeholder="Fecha de Nacimiento"/>
		</div>
	</div>
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'dni', 'error')} required">
		<label for="dni">
			<g:message code="user.dni.label" default="Dni" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="dni" type="number" value="${userInstance.dni}" required="" placeholder="12222333"/>
		</div>
	</div>	
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'telefonoFijo', 'error')} required">
		<label for="telefonoFijo">
			<g:message code="user.telefonoFijo.label" default="Teléfono Fijo" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="telefonoFijo" type="number" value="${userInstance.telefonoFijo}" required="" placeholder="45555555"/>
		</div>
	</div>
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'telefonoMovil', 'error')} required">
		<label for="telefonoMovil">
			<g:message code="user.telefonoMovil.label" default="Teléfono Móvil" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="telefonoMovil" type="number" value="${userInstance.telefonoMovil}" required="" placeholder="1566667777"/>
		</div>
	</div>
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'calle', 'error')} required">
		<label for="calle">
			<g:message code="user.calle.label" default="Calle" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:textField name="calle" required="" value="${userInstance?.calle}" placeholder="Calle"/>
		</div>
	</div>
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'numeroDireccion', 'error')} required">
		<label for="numeroDireccion">
			<g:message code="user.numeroDireccion.label" default="Dirección número" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="numeroDireccion" type="number" value="${userInstance.numeroDireccion}" required="" placeholder="Dirección número"/>
		</div>
	</div>
	
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'piso', 'error')} required">
		<label for="piso">
			<g:message code="user.piso.label" default="Piso" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="piso" type="number" value="${userInstance.piso}" required="" placeholder="Piso"/>
		</div>
	</div>
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'numeroDepartamento', 'error')} required">
		<label for="numeroDepartamento">
			<g:message code="user.numeroDepartamento.label" default="Departamento/Oficina" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="numeroDepartamento" type="number" value="${userInstance.numeroDepartamento}" required="" placeholder="Número Departamento"/>
		</div>
	</div>

	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'codigoPostal', 'error')} required">
		<label for="codigoPostal">
			<g:message code="user.codigoPostal.label" default="Código Postal" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="codigoPostal" type="number" value="${userInstance.codigoPostal}" required="" placeholder="Código Postal"/>
		</div>
	</div>
  </div>
</div>

<g:if test="${session?.user?.role?.value == 'admin'}">
<div class="panel panel-info">
  <div class="panel-heading">
	<h3 class="panel-title">Datos comerciales</h3>
  </div>
  <div class="panel-body">
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'minimoCompra', 'error')} required">
		<label for="minimoCompra">
			<g:message code="user.minimoCompra.label" default="Compra mínima" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-edit"></i></span>
			<g:field name="minimoCompra" value="${fieldValue(bean: userInstance, field: 'minimoCompra')}" required="" placeholder="Compra mínima"/>
		</div>
	</div>
	

	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'estado', 'error')} required">
		<label for="estado">
			<g:message code="user.estado.label" default="Estado" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-search"></i></span>
			<g:select name="estado" from="${kioscodeal.EstadoCliente?.values()}" keys="${kioscodeal.EstadoCliente.values()*.name()}" optionValue="value" required="" value="${userInstance?.estado?.name()}" class="many-to-one form-control" placeholder="Estado"/>
		</div>
	</div>
	
	<div class="form-group fieldcontain ${hasErrors(bean: userInstance, field: 'role', 'error')} required">
		<label for="role">
			<g:message code="user.role.label" default="Rol" />
			<span class="required-indicator">*</span>
		</label>
		<div class="input-group input-group">
			<span class="input-group-addon"><i class="fa fa-search"></i></span>
			<g:select name="role" from="${kioscodeal.Role?.values()}" keys="${kioscodeal.Role.values()*.name()}" optionValue="value" required="" value="${userInstance?.role?.name()}" class="many-to-one form-control" placeholder="Rol"/>
		</div>
	</div>
  
  
  </div>
</div>
</g:if>
